package ModelLayer;
/**
 * The class Person creates object that holdes the information of a person who can loan dvd's.
 * 
 * @author (Gruppe B) 
 * @version (1.0)
 */
public class Person
{
    /**
     * Instance variables.
     */
    private int id;
    private static int idCounter = 0;
    private String name;
    private String address;
    private String postalCode;
    private String city;
    private String phone;

    /**
     * Constructor for objects of class Person
     */
    public Person(String name, String address, String postalCode, String city, String phone)
    {       
        id = idCounter();
        this.name = name;
        this.address = address;
        this.postalCode = postalCode;
        this.city = city;
        this.phone = phone;        
    }
    
    /**
     * A counter method that makes sure that every id is unique.
     */
    private int idCounter()
    {
        idCounter++;
        int currentId = idCounter;
        return currentId;
    }
    
    /**
     * Sets the name of the person.
     */
    public void setName(String name)
    {
        this.name = name;
    }
    
    /**
     * Sets the address of the person.
     */
    public void setAddress(String address)
    {
        this.address = address;
    }
    
    /**
     * Sets the postal code of the person.
     */
    public void setPostalCode(String postalCode)
    {
        this.postalCode = postalCode;
    }
    
    /**
     * Sets the city of the person.
     */
    public void setCity(String city)
    {
        this.city = city;
    }
    
    /**
     * Sets the phone number of the person.
     */
    public void setPhone(String phone)
    {
        this.phone = phone;
    }
    
    /**
     * Returns the id of the person.
     */
    public int getId()
    {
        return id;
    }
    
    /**
     * Prints out the information of the person.
     */
    public void printPersonInfo()
    {
        System.out.println();
        System.out.println("ID:           " + id);
        System.out.println("Name:         " + name);
        System.out.println("Address:      " + address);
        System.out.println("Postal code:  " + postalCode);
        System.out.println("City:         " + city);
        System.out.println("Telephone:    " + phone);
        System.out.println();
    }
    
    
}
